package com.baidu.www2;
class Shape{
    public void draw(){
        System.out.println("画一个图形");
    }
}
class Rect extends Shape{
    public void draw(){
        System.out.println("画一个矩形");
    }
}
class Cycle extends Shape{
    public void draw(){
        System.out.println("画一个圆圈");
    }
}
class Tri extends Shape{
    public void draw(){
        System.out.println("画一个三角形");
    }
}

public class Text2 {
    public static void drawMaps(){
        Rect rect=new Rect();
        Cycle cycle=new Cycle();
        Tri tri=new Tri();
        Shape [] shapes={rect,rect,cycle,tri};
        for (Shape shape:shapes){
            shape.draw();
        }
    }
    public static void main(String[] args) {
        drawMaps();
    }


    public static void drawShape(Shape shape){
        shape.draw();
    }
    public static void main1(String[] args) {
        drawShape(new Rect());
        drawShape(new Cycle());
        drawShape(new Tri() );
    }
}
